export const initFooter = () => {
  const scrollToTop = () => {
    // document.body.scrollTop = 0
    // document.documentElement.scrollTop = 0
    window.scrollTo({
      top: 0,
      behavior: 'smooth'
    })
  }

  useEventListener(window, 'scroll', () => {
    const movetop = document.getElementById('movetop')
    if (!movetop) return

    if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
      movetop.style.display = 'block'
    } else {
      movetop.style.display = 'none'
    }
  })

  return {
    scrollToTop
  }
}
